const MYSQL_CONFIG = require("../config/db");
const mysql = require("mysql");
const connection = mysql.createConnection(MYSQL_CONFIG);

connection.connect();

const exc = (sql) => {
  return new Promise((resolve, reject) => {
    connection.query(
      sql,
      function (error, results) {
        if (error) {
            reject(error);
        } else {
            resolve(results)
        }
      }
    );
  });
};

module.exports = exc;
// connection.end();
